// components/rating/rating.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    starId: Number,
    disabled: Boolean,
  },

  /**
   * 组件的初始数据
   */
  data: {
    starArr: [
      { id: 1 }, 
      { id: 2 }, 
      { id: 3 }, 
      { id: 4 }, 
      { id: 5 }
    ],
    srcSelected: '/images/star.png',
    srcGray: '/images/grayStar.png',
  },

  /**
   * 组件的方法列表
   */
  methods: {
    select(e) {
      var starId = e.currentTarget.dataset.id;
      this.setData({
        starId: starId
      })
      this.triggerEvent('selectLevel', { starLevel: starId })
    }
  }
})
